package com.swiot.quartz.task;

import com.swiot.biz.domain.TemplateData;
import com.swiot.biz.service.ITemplateDataService;
import com.swiot.common.utils.StringUtils;
import org.apache.commons.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 定时任务调度测试
 */
@Component("budgetTask")
public class BudgetTask
{

    private static final Logger log = LoggerFactory.getLogger(BudgetTask.class);

    @Resource
    ITemplateDataService templateDataService;



    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }


    /**
     * 执行定时任务
     */
    public void pushBudget(String templateId,String year)
    {
        TemplateData queryData = new TemplateData();
        queryData.setTemplateId(templateId);
        HashMap<String, Object> templateDataSum = templateDataService.queryTemplateDataSum(templateId,year);
        if (templateDataSum == null)
        {
            return;
        }
        log.info("执行告警方法：{}", templateDataSum);

    }
}
